package com.loto.insurance.mis.web.enumeration;

public enum AuthorityRoleEnum {
	NOT_SPECIFIED("非内部用户", 0), USERS("普通内部用户", 1), ADMIN(
			"管理员", 2);

	private String name;
	private int index;

	private AuthorityRoleEnum(String name, int index) {
		this.name = name;
		this.index = index;
	}

	public static String getName(int index) {
		for (AuthorityRoleEnum c : AuthorityRoleEnum.values()) {
			if (c.getIndex() == index) {
				return c.name;
			}
		}
		return null;
	}

	public static int getIndex(String name) {
		for (AuthorityRoleEnum c : AuthorityRoleEnum.values()) {
			if (c.getName() == name) {
				return c.index;
			}
		}
		return 0;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}
}
